package com.yijian.oj.judge.codesandbox.impl;

import com.yijian.oj.judge.codesandbox.CodeSandBox;
import com.yijian.oj.judge.codesandbox.model.ExecuteCodeRequest;
import com.yijian.oj.judge.codesandbox.model.ExecuteCodeResponse;
import com.yijian.oj.judge.codesandbox.model.JudgeInfo;
import com.yijian.oj.model.enums.JudgeInfoMessageEnum;
import com.yijian.oj.model.enums.QuestionSubmitStatusEnum;

import java.util.List;

/**
 * 示例代码沙箱
 * @author ItJianGe
 * @data 2024/3/25 8:11
 */
public class ExampleCodeSandBox implements CodeSandBox {
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest codeRequest) {
        List<String> input = codeRequest.getInput();

        ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();
        executeCodeResponse.setOutput(input);
        executeCodeResponse.setMessage(QuestionSubmitStatusEnum.RUNNING.getText());
        executeCodeResponse.setStatue(QuestionSubmitStatusEnum.RUNNING.getValue());

        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getValue());
        judgeInfo.setTime(10L);
        judgeInfo.setMemory(100L);

        executeCodeResponse.setJudgeInfo(judgeInfo);
        return executeCodeResponse;
    }
}
